-
Choose View Source File from the pull-down list at the bottom of the window.
Project Builder becomes active and displays the code for Main.java. Notice the following declaration that was added to your code when you added the currentGuest variable:
protected Guest currentGuest;
-
Delete the declarations of guestName, email, and comments since you aren't using them anymore.
-
Add the constructor method inside the Main class definition:
public Main() {
super();
currentGuest = new Guest();
}
The first statement calls the constructor of Main's superclass (which is com.apple.yellow.webobjects.WOComponent). The second statement allocates a new empty Guest object and calls Guest's constructor to initialize its instance variables.
-
Save Main.java.
-
Build and run your application.
The application should work similarly to that in the first chapter, except that the guest's data is displayed in a table at the bottom of the page instead of as plain text.
At this point, your application still handles information from a single guest only; in the next section, you'll modify the application so that it can keep track of multiple guests.